blob: 7f4c44bbbfcd8990866a0db05f550c3a751ac556 [file] [log] [blame]
/*
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/
package flex.ant.config;
/**
* A value object which contains a prefix, name and alias.
*/
public class OptionSpec
{
private String prefix;
private String name;
private String alias;
/**
*
*/
public OptionSpec(String name)
{
this.name = name;
}
/**
*
*/
public OptionSpec(String prefix, String name)
{
this.prefix = prefix;
this.name = name;
}
/**
*
*/
public OptionSpec(String prefix, String name, String alias)
{
this.prefix = prefix;
this.name = name;
this.alias = alias;
}
/**
*
*/
public String getFullName()
{
String result;
if (prefix != null)
{
result = prefix + "." + name;
}
else
{
result = name;
}
return result;
}
/**
*
*/
public String getName()
{
return name;
}
/**
*
*/
public String getPrefix()
{
return prefix;
}
/**
*
*/
public String getAlias()
{
return alias;
}
/**
*
*/
public boolean matches(String option)
{
boolean result = false;
if ((prefix != null) && option.equals(prefix + "." + name))
{
result = true;
}
else if (option.equals(name))
{
result = true;
}
else if ((alias != null) && option.equals(alias))
{
result = true;
}
return result;
}
} //End of OptionSpec