/** * Gets the value of the value property. * * @return possible object is * {@link String } */ @XmlAttribute(required = true) @Attribute(required = true) public String getValue();
protected boolean hasDefault() { boolean noDefaultValue = a.defaultValue().length() == 1 && a.defaultValue().charAt(0) == '\u0000'; return (!noDefaultValue); } /**
private AttributeMethodGenerator(Property p, Attribute a) { super("attribute_", injectAttributeMethod, p, a.value()); this.a = a; }
/** * Generates the injector that reads an attribute and sets the value. */ @Override protected void generate() { addToMetadata(metadata, xmlTokenName(),isRequired()?"required":"optional"); if (this.hasDefault()) { if (a.defaultValue().indexOf(',')!=-1) { addToMetadata(metadata, xmlTokenName(), '"' + "default:" + a.defaultValue() + '"'); } else { addToMetadata(metadata, xmlTokenName(), "default:" + a.defaultValue()); } } String ant = ""; try { a.dataType(); } catch(MirroredTypeException me) { //hack? ant = getCanonicalTypeFrom(me); } if (ant.length() == 0) { //take it from the return type of method Property.Method m = (Property.Method)p; // Method needn't be Property's inner class String typeReturnedByMethodDecl = m.method.getReturnType().toString(); addToMetadata(metadata, xmlTokenName(), "datatype:" + typeReturnedByMethodDecl); } else { addToMetadata(metadata, xmlTokenName(), "datatype:" + ant); } super.generate(); }
/** * Gets the value of the intervalInSeconds property. * * Interval, in seconds, between health checks. A value of "0" means that * the health check is disabled. Default is 30 seconds. Must be 0 or greater. * * @return possible object is * {@link String } */ @Attribute (defaultValue="30") @Min(value=0) public String getIntervalInSeconds();
public static DescriptorSupport descriptor(final AttributeMethodInfo info) { final DescriptorSupport d = new DescriptorSupport(); final Attribute a = info.attribute(); d.setField(DESC_KIND, Attribute.class.getName()); if (!a.defaultValue().equals("\u0000")) { d.setField(DESC_DEFAULT_VALUE, a.defaultValue()); } d.setField(DESC_KEY, a.key()); d.setField(DESC_REQUIRED, a.required()); d.setField(DESC_REFERENCE, a.reference()); d.setField(DESC_VARIABLE_EXPANSION, a.variableExpansion()); d.setField(DESC_DATA_TYPE, info.inferDataType().getName()); return d; }
private void printAttributeData(final Attribute annotation) { printKeyValue(detail, annotation != null ? annotation.dataType().getName() : null); printKeyValue(detail, annotation != null ? annotation.defaultValue() : null); printKeyValue(detail, annotation != null && annotation.required()); }
private boolean _isKey() { Element e = getAnnotation(Element.class); if(e!=null && e.key()) return true; Attribute a = getAnnotation(Attribute.class); return a != null && a.key(); }
protected boolean isRequired() { return a.required(); }
/** * Gets the value of the maxMissedHeartbeats property. * <p/> * Maximum number of attempts to try before GMS confirms that a failure is * suspected in the group. Must be a positive integer. * * @return possible object is * {@link String } */ @Attribute(defaultValue = "3") @Min(value = 1) String getMaxMissedHeartbeats();
private void printAttributeData(final Attribute annotation) { printKeyValue(detail, annotation != null ? annotation.dataType().getName() : null); printKeyValue(detail, annotation != null ? annotation.defaultValue() : null); printKeyValue(detail, annotation != null && annotation.required()); }
/** * Generates the injector that reads an attribute and sets the value. */ @Override protected void generate() { addToMetadata(metadata, xmlTokenName(),isRequired()?"required":"optional"); if (this.hasDefault()) { if (a.defaultValue().indexOf(',')!=-1) { addToMetadata(metadata, xmlTokenName(), '"' + "default:" + a.defaultValue() + '"'); } else { addToMetadata(metadata, xmlTokenName(), "default:" + a.defaultValue()); } } String ant = ""; try { a.dataType(); } catch(MirroredTypeException me) { //hack? ant = getCanonicalTypeFrom(me); } if (ant.length() == 0) { //take it from the return type of method Property.Method m = (Property.Method)p; // Method needn't be Property's inner class String typeReturnedByMethodDecl = m.method.getReturnType().toString(); addToMetadata(metadata, xmlTokenName(), "datatype:" + typeReturnedByMethodDecl); } else { addToMetadata(metadata, xmlTokenName(), "datatype:" + ant); } super.generate(); }
@Override public boolean optional() { return !attr.key(); }
public boolean required() { return mAttribute.required(); }